<% layout('/layout/default.html', {title: '区域管理', libs: ['validate','icheck']}){ %>
<div class="main-content">
	<div class="container-fluid">
		<div class="card-header">
			<i class="fa fa-sitemap"></i> ${area.isNewRecord?'添加区域':'修改区域信息'}
		</div>
		<#form:form id="inputForm" model="${area}" class="form-horizontal" action="${ctx}/sys/area/save" method="post">
		<div class="card-body">
			<#form:hidden path="id"/>
			<div class="row">
				<div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
					<div class="form-group row">
						<label class="col-form-label col-lg-4 col-md-4 text-right" for="" title="上级区域">
							上级区域:
						</label>
						<div class="col-lg-8 col-md-8 ">
							<div  class="form-control form-control-sm" readonly="readonly">
								<#form:hidden path="parent.id"/>
								<% if(isEmpty(area.parent.id)|| area.parent.id == "0") {%>
								根区域
								<% } else{ %>
								${area.parent.name}
								<% } %>
							</div>
						</div>
					</div>
				</div>
				<div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
					<div class="form-group row">
						<label class="col-form-label col-lg-4 col-md-4 text-right" title="区域类型">
							<span style="color:red;" aria-required="true">*</span>区域类型:<i class="fa icon-question hide"></i>
						</label>
						<div class="col-lg-8 col-md-8 ">
							<#form:select path="type" name="label" data="getDictList:sys_area_type" class="form-control select2bs4 required">
						</#form:select>
						</div>
					</div>
				</div>
			</div>
			<div class="row">
				<div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
					<div class="form-group row">
						<label class="col-form-label col-lg-4 col-md-4 text-right" title="区域名称">
							<span style="color:red;" aria-required="true">*</span> 区域名称:<i class="fa icon-question hide"></i></label>
						<div class="col-lg-8 col-md-8 ">
							<#form:input path="name" maxlength="64" class="form-control form-control-sm required "/>
						</div>
					</div>
				</div>
				<div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
					<div class="form-group row">
						<label class="col-form-label col-lg-4 col-md-4 text-right" title="编码">
							区域编码：
						</label>
						<div class="col-lg-8 col-md-8 ">
							<#form:input path="code" type="text" maxlength="64"  class="form-control form-control-sm"/>
						</div>
					</div>
				</div>
			</div>
			<div class="row">
				<div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
					<div class="form-group row">
						<label class="col-form-label col-lg-4 col-md-4 text-right" title="排序">
							<span style="color:red;" aria-required="true">*</span>排序：<i class="fa icon-question hide"></i>
						</label>
						<div class="col-lg-8 col-md-8 ">
							<#form:input path="sort" maxlength="64" class="form-control form-control-sm required "/>
						</div>
					</div>
				</div>
				<div class="col-md-6">
					<div class="form-group row">
						<label class="col-form-label col-lg-4 col-md-4 text-right" title="备注信息">
							备注：<i class="fa icon-question hide"></i>
						</label>
						<div class="col-sm-8">
							<#form:textarea path="remarks" rows="3" cols="32"  class="form-control" />
						</div>
					</div>
				</div>
			</div>
		</div>
		<div class="box-footer">
			<div class="row">
				<div class="offset-md-2 col-md-10">
					<% if (hasPermi('sys:area:edit')){ %>
					<button type="submit" class="btn btn-sm btn-primary" id="btnSubmit"><i class="fa fa-check"></i> 保 存</button>
					<% } %>
					<button type="button" class="btn btn-sm btn-default" id="btnCancel" onclick="window.parent.closeCurrentTabPage();"><i class="fa fa-reply-all"></i> 关 闭</button>
				</div>
			</div>
		</div>
		</#form:form>
</div>
</div>
<% } %>
<script>
	$("#inputForm").validate({
		submitHandler: function(form){
			js.ajaxSubmitForm($(form), function(data){
				js.showMessage(data.message);
				console.log(data.message);
				if(data.result == 'true'){
					window.parent.closeCurrentTabPage(window.parent.refreshTab);
				}
			});
		}
	});
</script>
